<template>
	<section>
		<!--工具条-->
		<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
			<el-form :inline="true" :model="filters">
				<el-form-item>
					<el-input v-model="filters.username" placeholder="姓名"></el-input>
				</el-form-item>
        <el-form-item>
					<el-input v-model="filters.userid" placeholder="编号"></el-input>
				</el-form-item>
				<el-form-item>
					<el-button type="primary" v-on:click="getUser">查询</el-button>
				</el-form-item>
			</el-form>
		</el-col>

		<!--列表-->
		<template>
			<el-table :data="users" highlight-current-row v-loading="loading" style="width: 100%;">
				<el-table-column type="index" width="60">
				</el-table-column>
				<el-table-column prop="f_userid" label="编号" width="120" sortable>
				</el-table-column>
				<el-table-column prop="f_username" label="姓名" width="100"  sortable>
				</el-table-column>
				<el-table-column prop="f_useraddress" label="地址" width="100" sortable>
				</el-table-column>
				<el-table-column prop="f_userphone" label="电话" width="120" sortable>
				</el-table-column>
        	<el-table-column prop="f_usermachinetype" label="设备类型" min-width="180" sortable>
				</el-table-column>
				<el-table-column prop="f_usermachineid" label="设备号" min-width="180" sortable>
				</el-table-column>
        <el-table-column prop="f_userstate" label="用户状态" min-width="180" sortable>
				</el-table-column>
        <el-table-column prop="f_meterestate" label="设备状态" min-width="180" sortable>
				</el-table-column>
        <el-table-column prop="f_stairpricename" label="价格类型" min-width="180" sortable>
				</el-table-column>
				<el-table-column prop="f_effectdatename" label="日期类型" min-width="180" sortable>
				</el-table-column>
        <el-table-column prop="f_opendate" label="开户日期" min-width="180" sortable>
				</el-table-column>
			</el-table>
		</template>

	</section>
</template>
<script>
	import { getUserList } from '../../api/api';
	//import NProgress from 'nprogress'
	export default {
		data() {
			return {
				filters: {
          username: '',
          userid: ''
				},
				loading: false,
				users: [
				]
			}
		},
		methods: {
			//性别显示转换
			formatSex: function (row, column) {
				return row.sex == 1 ? '男' : row.sex == 0 ? '女' : '未知';
			},
			//获取用户列表
			getUser: function () {
        
				let para = {
          username: this.filters.username,
          userid: this.filters.userid
        };
        console.log(para);
				this.loading = true;
				//NProgress.start();
				getUserList(para).then((res) => {
          console.log(res);
					this.users = res.data;
					this.loading = false;
				//	NProgress.done();
				
				});
			}
		},
		mounted() {
			this.getUser();
		}
	};

</script>

<style scoped>

</style>